Skip to content

Conversation

@SimonVutovB
Copy link
Contributor

@SimonVutovB SimonVutovB commented Nov 3, 2025

@SimonVutovB SimonVutovB requested review from a team as code owners November 3, 2025 18:08
Copy link
Contributor

@OttoAllmendinger OttoAllmendinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flush: not btc

@SimonVutovB SimonVutovB force-pushed the WP-1338-WRW-bugs-1-Build-Unsigned-Consolidation-screen branch from 500a538 to 2b6bd0f Compare November 4, 2025 16:57
seed: Yup.string(),
}).required();

const validationSchema = getValidationSchema('cold');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a dangling const ?


const formik = useFormik<EcdsaFormValues>({
onSubmit,
initialValues: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add walletType as the form state, and default to cold. That way you won't need an extra state, and you won't need to add a hook, it could be a straight forward function (useWalletTypeLabels)

seed: Yup.string(),
}).required();

const validationSchema = getValidationSchema('cold');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

@SimonVutovB SimonVutovB force-pushed the WP-1338-WRW-bugs-1-Build-Unsigned-Consolidation-screen branch from 91e723f to 313a656 Compare November 5, 2025 14:45
Copy link
Contributor

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's update the Yup schema, unsure if we need the validation changes added.

Comment on lines 13 to 25
const getValidationSchema = (walletType: WalletType) => Yup.object({
walletType: Yup.string().oneOf(['cold', 'hot']).required(),
userKey: Yup.string().required(),
backupKey: Yup.string().required(),
bitgoKey: Yup.string().required(),
walletPassphrase: Yup.string(),
walletPassphrase: walletType === 'hot' ? Yup.string().required() : Yup.string(),
startingScanIndex: Yup.number(),
endingScanIndex: Yup.number().moreThan(
Yup.ref('startingScanIndex'),
'Ending scan index must be greater than starting scan index'
),
seed: Yup.string(),
}).required();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that walletType is a form value, I don't think you need to make this dynamic: https://stackoverflow.com/questions/49394391/conditional-validation-in-yup

Comment on lines 49 to 62
validate: (values) => {
try {
getValidationSchema(values.walletType as WalletType).validateSync(values, { abortEarly: false });
return {};
} catch (error: any) {
const errors: Record<string, string> = {};
error.inner?.forEach((err: any) => {
if (err.path) {
errors[err.path] = err.message;
}
});
return errors;
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this?

Comment on lines 68 to 82
validate: (values) => {
try {
getValidationSchema(values.walletType as WalletType).validateSync(values, { abortEarly: false });
return {};
} catch (error: any) {
const errors: Record<string, string> = {};
error.inner?.forEach((err: any) => {
if (err.path) {
errors[err.path] = err.message;
}
});
return errors;
}
},
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@SimonVutovB SimonVutovB self-assigned this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants